package com.young.modbus.controller;

import com.young.modbus.domain.PlcStatus;
import com.young.modbus.service.ModbusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Young
 * @CreateTime: 2024-12-24
 * @Description: plc控制器
 * @Version: 1.0
 */
@RestController
@RequestMapping("plc")
public class PlcController {

    @Autowired
    private ModbusService service;

    private final PlcStatus status;

    @Autowired
    public PlcController(PlcStatus status) {
        this.status = status;
    }


    /**
     * 给白平衡测试系统用的
     * 写入扫码结果
     * @param val (1:Ok、2:NG)
     * @return
     */
    @GetMapping("/writeScanRes/{val}")
    public void writeScanRes(@PathVariable("val")short val){
        service.writeScanRes(val);
    }

}
